package org.example.day20240830正则;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class zhengZe {
    public static void main(String[] args) {
        String str = "0x1F";
        System.out.println(str.matches("0x[0-9a-fA-F]{2}"));

        //正则表达式截取字符串
        String line ="张三  2024/6/3 2024/6/3 8:11   2024/6/3 18:58 是";
        String[] msg1 = line.split("\\s+");//截取多个空格

        String msg = "hello264-29877654wor764-20877654ld";
        Pattern pat = Pattern.compile("([0-9]{3})-([0-9]{8})");
        Matcher matcher = pat.matcher(msg);
//        System.out.println(matcher.groupCount());
        while (matcher.find()){
            System.out.println(matcher.group());
            System.out.println(matcher.group(0));
            System.out.println(matcher.group(1));
//            System.out.println(matcher.group(2));
        }

    }
}
